package org.example.qweqq.utils;

public class ThreadLocalUtil {
    // 提供 ThreadLocal 对象
    private static final ThreadLocal<Object> THREAD_LOCAL = new ThreadLocal<>();

    // 根据键获取值
    public static <T> T get() {
        return (T) THREAD_LOCAL.get();
    }

    // 存储值
    public static void set(Object value) {
        THREAD_LOCAL.set(value);
    }

    // 移除 ThreadLocal 中的值，防止内存泄漏
    public static void remove() {
        THREAD_LOCAL.remove();
    }
}